package com.hadoop.mr.amiudake.max;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class MaxMapper extends Mapper<LongWritable, Text, Text, Text> {

	@Override
	protected void map(LongWritable key, Text value, org.apache.hadoop.mapreduce.Mapper.Context context)
			throws IOException, InterruptedException {
		try {
			String year = value.toString().substring(8, 12);
			context.write(new Text(year), new Text(value.toString().substring(12, 16)+"-"+value.toString()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
